package org.theonept.travian.dao;

import java.sql.SQLException;
import java.util.List;

import org.theonept.travian.model.Compte;

import com.j256.ormlite.dao.BaseDaoImpl;

public class CompteDAO extends BaseDaoImpl<Compte,Long> {
	private DatabaseHelper databaseHelper;
	private static CompteDAO INSTANCE;
	public static CompteDAO getINSTANCE() {
		if (INSTANCE == null){
			try {
				INSTANCE = new CompteDAO();
			} catch (SQLException e) {
				
				e.printStackTrace();
			}
		}
		return INSTANCE;
	}
	protected CompteDAO() throws SQLException {
		super(Compte.class);
		databaseHelper = DatabaseHelper.getInstance();
		setConnectionSource(databaseHelper.getConnectionSource());
		initialize();

		
	}
	
	@Override
	public int create(Compte arg0)  {
		try {
			return super.create(arg0);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return -1;
	}
	@Override
	public List<Compte> queryForAll()   {
		// TODO Auto-generated method stub
		try {
			return super.queryForAll();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	
}
